<template>
    <div class="login">
        <div class="logins">
            <div class="logins-logo">
                <img src="../../../static/images/logo.png" alt="">
            </div>
            <div class="logins-m">
                <div class="logins-input">
                    <input type="text" v-model="userName" placeholder="请输入用户名">
                </div>
                <div class="logins-input">
                    <input type="password" v-model="userPassword" placeholder="请输入密码">
                </div>
                <!-- <div class="logins-input logins-inputs">
                    <input type="password" v-model="userCode" placeholder="图片验证码">
                    <div class="logins-code"></div>
                </div> -->
                <div class="logins-btn" @click="logins()">
                    登录
                </div>
            </div>
        </div>
    </div>
</template>
<script>
export default {
  data() {
    return {
      userName: "",
      userPassword: "",
      userCode: ""
    };
  },
  methods: {
    logins() {
      let _this = this;
      let datas = {
        username: _this.userName,
        password: _this.userPassword
      };
      datas = JSON.stringify(datas);
      _this
        .$http({
          url: _this.urls + "/login.do",
          method: "post",
          data: datas
        })
        .then(function(res) {
          let data = res.data;
          if (data.status == "success") {
            localStorage.setItem("loginFlag", 1);
            _this.$router.push("/main");
          } else {
            _this.$message({
              showClose: true,
              message: data.msg,
              type: "error"
            });
          }
        })
        .catch(function(error) {
          console.log(error);
        });
    }
  }
};
</script>
<style lang="less" scoped>
@import "login.less";
</style>



 